From 70c79646aed56344e2e21f3b738443c135c8211d Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Fri, 5 Aug 2022 20:28:51 +0200 Subject: show recent matches on bots page --- web/pw-server/src/routes/bots/[bot_name].svelte | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'web/pw-server/src/routes/bots/[bot_name].svelte') diff --git a/web/pw-server/src/routes/bots/[bot_name].svelte b/web/pw-server/src/routes/bots/[bot_name].svelte index 33a522f..48aef21 100644 --- a/web/pw-server/src/routes/bots/[bot_name].svelte +++ b/web/pw-server/src/routes/bots/[bot_name].svelte @@ -10,8 +10,17 @@ }, }); - if (res.ok) { + const matches_res = await fetch(`/api/matches?bot=${params["bot_name"]}`, { + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${token}`, + }, + }); + + + if (res.ok && matches_res.ok) { const { bot, owner, versions } = await res.json(); + const matches = await matches_res.json(); // sort most recent first versions.sort((a: string, b: string) => dayjs(a["created_at"]).isAfter(b["created_at"]) ? -1 : 1 @@ -21,6 +30,7 @@ bot, owner, versions, + matches, }, }; } @@ -34,12 +44,13 @@